package com.example.qxfw.dataBaseManager.nyzjk.service.impl;

import com.example.qxfw.common.entity.ny.AgriWeatherDistRecord;
import com.example.qxfw.common.entity.ny.StationInfo;
import com.example.qxfw.common.mapper.AgriWeatherDistRecordMapperXml;
import com.example.qxfw.common.mapper.CommonMapper;
import com.example.qxfw.dataBaseManager.nyzjk.service.QxzhlskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/************************************
 *
 * @author : HuangDeYin Jolly
 * @since : JDK 11
 * @Date : 2023/7/6  星期四   9:21
 * @description : 此类用来
 ***************************************/
@Service
public class QxzhlskServiceImpl implements QxzhlskService {

    @Autowired
    private AgriWeatherDistRecordMapperXml agriWeatherDistRecordMapperXml;

    @Autowired
    private CommonMapper<StationInfo> commonMapperStationInfo;

    @Autowired
    private CommonMapper<AgriWeatherDistRecord> commonMapperAgriWeatherDistRecord;

    @Override
    public List<AgriWeatherDistRecord> selectAll() {
        return this.agriWeatherDistRecordMapperXml.selectList(null);
    }

    @Override
    public List<AgriWeatherDistRecord> getDisasterType( ) {
        return this.agriWeatherDistRecordMapperXml.SelectColumn("distinct disastertype", null, Integer.parseInt(null));
    }

    @Override
    public List<StationInfo> selectStationInfo(String column, String tableName, String query ,String order, Integer limit) {
        List<StationInfo> station_info = this.commonMapperStationInfo.selectData(column, tableName, query, order, limit);
        return station_info;
    }

    @Override
    public List<AgriWeatherDistRecord> selectAgriWeatherDistRecord(String column, String tableName, String query ,String order, Integer limit){
        List<AgriWeatherDistRecord> agriWeatherDistRecords = this.commonMapperAgriWeatherDistRecord.selectData(column, tableName, query, order, limit);
        return agriWeatherDistRecords;
    }

    @Override
    public Integer saveAgriWeatherDistRecord(final AgriWeatherDistRecord agriWeatherDistRecord) {
        return this.agriWeatherDistRecordMapperXml.insertSelective(agriWeatherDistRecord);
    }

    @Override
    public Integer updateAgriWeatherDistRecord(final AgriWeatherDistRecord agriWeatherDistRecord) {
        return this.agriWeatherDistRecordMapperXml.updateByPrimaryKeySelective(agriWeatherDistRecord);
    }

    @Override
    public Integer deleteAgriWeatherDistRecord(int id) {
        return this.agriWeatherDistRecordMapperXml.deleteById(id);
    }
}
